    const shadow = document.querySelector(".shadow")
    const inputWarp = document.querySelector(".inputWarp")
    const box = document.querySelector('.box')
    const warp = document.querySelector('.warp')
    const bgWarp = document.querySelector('.bgWarp')
    const menu = document.querySelectorAll(".menu span")
    const menuContent = document.querySelectorAll(".menuContent .item")
    const searchWarp = document.querySelector(".searchWarp")
    const input = document.querySelector("input")
    //获取当前时间


    // console.log(h1);
    //定时器
    //每个一秒执行一次
    setInterval(() => {
        var date = new Date()
        var year = date.getFullYear()
        var month = date.getMonth() + 1
        var day = date.getDate()
        var hour = date.getHours()
        var min = date.getMinutes()
        var sec = date.getSeconds()
        var week = date.getDay()
        let tem = tempFn(week)
        const h1 = document.querySelector("h1")
        const h5 = document.querySelector("h5")
        h1.innerHTML = hour + " : " + time(min) + " : " + time(sec)
        h5.innerHTML = year + " 年 " + month + " 月 " + day + " 日" + " 星期" + tem
        // console.log(week,'week');
    }, 1000)

    function tempFn(week){
       const array = ['一','二','三','四','五','六','日']
       let a = array[week - 1]
        return a
    }

    function time(data) {
        if(data < 10){
            return "0" + data
        } else {
            return data
        }
    }

    function handleSearch() {
        shadow.style.display = "none"
        inputWarp.style.filter = "blur(0px)"
    }

    function handle(){
        shadow.style.display = "block"
        inputWarp.style.filter = "blur(3px)"
        warp.style.display = 'block'
        box.style.display = 'none'
        bgWarp.style.transform = "scale(1)";
        bgWarp.style.filter = "blur(0px)"
        
    }

    function handleMenu() {
        warp.style.display = 'none'
        box.style.display = 'block'
        bgWarp.style.transform = "scale(1.2)";
        bgWarp.style.filter = "blur(3px)"
    }

    function fn() {
        menuContent.forEach((item) => {
            item.style.display = 'none'
        })
    }

    menu.forEach((item,index) => {
        fn()
        menuContent[0].style.display = 'flex'
        item.onclick = function() {
            fn()
            menuContent[index].style.display = 'flex'
            menu.forEach(data => {
                data.style.borderBottom = 'none'
            })
            item.style.borderBottom = '1px solid #fff'
        }
        
    })
  
    function test(data) {
        console.log(data);
        //原窗口跳转，不打开新标签页
        window.location.href = data
        //打开并进入新标签页
        window.open(data)
    }

    function search(){
        fetch('https://rlsbj.cq.gov.cn/IGI/nbhd/openGovmsgbox.do?siteId=182&beginTime=2024-01-01%2000%3A00%3A00&endTime=2024-11-25%2023%3A59%3A59&method=countOpenGovmsgboxByMonth&appId=' + input.value)
        .then(response => response.json()) // 解析 JSON 数据
        .then(data => {
            //业务逻辑
            if(data.statusCode !== 200) {
                alert(data.message)
                return
            }
            data.datas.report.forEach((item,index)=>{
                console.log(item,index);
                const li = document.createElement("li")
                li.innerHTML = item.yearMonth
                li.setAttribute('onclick', `hand('${item.yearMonth}')`)
                searchWarp.style.display = 'block'
                
                searchWarp.appendChild(li)
            })
            
        })   // 处理数据
        .catch(error => console.error('Error:', error)); // 错误处理
        
    }
    
    function change(){
        if(!input.value) {
            searchWarp.innerHTML = ''
            searchWarp.style.display = 'none'
        }
    }

    function hand(data){
        console.log(data);
        
    }